Class HCC.DT.HCC2HL72.ApptBookQue Extends Ens.DataTransformDTL [ DependsOn = (EnsLib.EDI.XML.Document, EnsLib.HL7.Message) ]
{

Parameter IGNOREMISSINGSOURCE = 1;

Parameter REPORTERRORS = 1;

Parameter TREATEMPTYREPEATINGFIELDASNULL = 0;

XData DTL [ XMLNamespace = "http://www.intersystems.com/dtl" ]
{
<transform sourceClass='EnsLib.EDI.XML.Document' targetClass='EnsLib.HL7.Message' sourceDocType='PRPA_IN900300UV:PRPA_IN900300UV' targetDocType='2.5.1:SQM_S25' create='new' language='objectscript' >
<assign value='source.{id().extension}' property='target.{MSH:MessageControlID}' action='set' />
<assign value='source.{creationTime().value}' property='target.{MSH:DateTimeOfMessage.Time}' action='set' />
<assign value='"SQM"' property='target.{MSH:MessageType.MessageCode}' action='set' />
<assign value='"S25"' property='target.{MSH:MessageType.TriggerEvent}' action='set' />
<assign value='source.{controlActProcess().queryByParameter.queryId.extension}' property='target.{QRD:QueryID}' action='set' />
<assign value='source.{controlActProcess().queryByParameter.patientId.value().item(1).extension}' property='target.{ARQgrp.PID:PatientID.IDNumber}' action='set' />
<assign value='source.{controlActProcess().queryByParameter.patientId.value().item(2).extension}' property='target.{ARQgrp.PID:PatientIdentifierList(1).IDNumber}' action='set' />
<foreach property='source.{controlActProcess(k1).queryByParameter.careEventID.value(k1).item()}' key='k1' >
<assign value='source.{controlActProcess(1).queryByParameter.careEventID.value(1).item(k1).extension}' property='target.{ARQgrp.ARQ:ScheduleID}' action='set' />
</foreach>
<assign value='source.{controlActProcess().queryByParameter.typeOfEncounter.value().item().displayName.value}' property='target.{ARQgrp.ARQ:AppointmentType.Text}' action='set' />
<assign value='source.{controlActProcess().queryByParameter.typeOfEncounter.value().item().code}' property='target.{ARQgrp.ARQ:AppointmentType.Identifier}' action='set' />
<assign value='source.{controlActProcess().queryByParameter.encounterTimeframe.value().low.value}' property='target.{ARQgrp.ARQ:RequestedStartDateTimeRange(1).RangeStartDateTime.Time}' action='set' />
<assign value='source.{controlActProcess().queryByParameter.encounterTimeframe.value().high.value}' property='target.{ARQgrp.ARQ:RequestedStartDateTimeRange().RangeEndDateTime.Time}' action='set' />
<assign value='source.{controlActProcess().queryByParameter.responsibleOrganization.value().item().extension}' property='target.{ARQgrp.ARQ:EnteredByLocation.Facility}' action='set' />
<assign value='source.{controlActProcess().queryByParameter.patientLocationID.value().item().extension}' property='target.{ARQgrp.ARQ:EnteredByLocation.Room}' action='set' />
</transform>
}

}
